﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YWTSSys.DAL;
using YWTSSys.Model;
using YWTSSys.Library;
using System.Data;

namespace YWTSSys.BLL
{
    public class CustomerGroupController
    {
        /// <summary>
        /// 添加区域
        /// </summary>
        /// <param name="分组标志"></param>
        /// <returns></returns>
        public static bool AddArea(string 分组标志)
        {
            return CustomerGroupDAL.AddArea(分组标志);
        }
        /// <summary>
        /// 新增分组
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static bool AddGroup(CustomerGroupInfo obj)
        {
            return CustomerGroupDAL.AddGroup(obj);
        }
        /// <summary>
        /// 删除区域
        /// </summary>
        /// <param name="DeleteArea"></param>
        /// <returns></returns>
        public static bool DeleteArea(string DeleteArea)
        {
            return CustomerGroupDAL.DeleteArea(DeleteArea);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="分组标志"></param>
        /// <returns></returns>
        public static bool DeleteGroup(string 分组标志)
        {
            return CustomerGroupDAL.DeleteGroup(分组标志);
        }
        /// <summary>
        /// 获取所有的区域
        /// </summary>
        /// <returns></returns>
        public static List<CustomerGroupInfo> GetAllArea()
	    {
            return CBO.FillCollection<CustomerGroupInfo>( CustomerGroupDAL.GetAllArea());
	    }
        /// <summary>
        /// 根据区域获取所有分组
        /// </summary>
        /// <param name="AreaName"></param>
        /// <returns></returns>
        public static DataTable GetAllGroupByArea(string AreaName)
        {
            return CustomerGroupDAL.GetAllGroupByArea(AreaName);
        }
        /// <summary>
        /// 更新业务员
        /// </summary>
        /// <param name="分组标志"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public static bool UpdateUser(string 分组标志, int UserId)
        {
            return CustomerGroupDAL.UpdateUser(分组标志, UserId);
        }
        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="groupName"></param>
        /// <returns></returns>
        public static CustomerGroupInfo GetByGroupName(string groupName)
        {
            return CBO.FillObject<CustomerGroupInfo>(CustomerGroupDAL.GetByGroupName(groupName));
        }
    }
}
